package main

import (
	"fmt"
	"tempconv"
)

// 同包下可以访问
const boilingF = 212.0

func main() {
	temp()
	tryPoint()
	testF()
	c := tempconv.AbsoluteZeroC
	fmt.Println(c)
}

func temp() {
	// 仅函数内访问
	var f = boilingF
	var c = (f - 32) * 5 / 9
	fmt.Printf("boiling point = %g°F or %g°C\n", f, c)
	fmt.Printf("%g°F = %g °C\n", boilingF, fToC(boilingF))
}

func fToC(f float64) float64 {
	return (f - 32) * 5 / 9
}

func tryPoint() {
	x := 1
	p := &x
	fmt.Println(p)
	fmt.Println(*p)
	*p = 2
	fmt.Println(x)
}

func testF() {
	i := f()
	i2 := f()
	fmt.Printf("1:%d, 2:%d, e:%t", i, i2, i == i2)
}

func f() *int {
	v := 1
	return &v
}
